<?php

App::uses('AppModel', 'Model');

class Opstina extends AppModel {

    public $useTable = 'opstine';
    public $order    = 'Opstina.id';
    
    public function getOptions() {
        $ret  = array();
        foreach ($this->find('all') as $row) {
            $grad = $row['Opstina']['grad'];
            $id   = $row['Opstina']['id'];
            $name = $row['Opstina']['name'];
            
            if (empty($ret[$grad])) $ret[$grad] = array();
            
            $ret[$grad][$id] = $name;
        }
        
        return $ret;
    }

}

?>